<template>
  <el-sub-menu :index="index" v-if="data.children">
    <template #title>
      <slot :row="data"></slot>
    </template>
    <menu_slot_row v-for="v in data.children" :data="v" @click:li="$emit('click:li', $event)">
      <template #default="{row}"><slot :row="row"></slot></template>
    </menu_slot_row>
  </el-sub-menu>
  <el-menu-item v-else :index="index" @click="$emit('click:li', data)">
    <slot :row="data"></slot>
  </el-menu-item>
</template>

<script>
import {to_string} from "@/js/s94_tool.js";

export default {
  name: "menu_slot_row",
  props: ['data'],
  emits: ['click:li'],
  methods: {
  },
  computed: {
    index(){
      return to_string(this.data?.path || this.data?.id);
    }
  },
  mounted() {
  }
}
</script>

<style>

</style>